<?php

namespace process\task;
use support\Service\LogService;
use Workerman\Timer;
class CleanLog
{
    public function onWorkerStart()
    {
        // 每隔1小时清除一下日志
        Timer::add(3600, function(){
           echo "开始清除操作日志\r\n";
           $service=new LogService();
           $service->model->delByWhere([['create_time','<=',time()-7200]]);
            echo "结束清除操作日志\r\n";
        });
    }
}